package androidx.recyclerview.widget;

import android.view.View;

class ViewBoundsCheck {
    final e ˋ;
    a ˎ = new a();

    interface e {
        int ˊ();

        int ˊ(View view);

        View ˎ(int i);

        int ˏ();

        int ॱ(View view);
    }

    static class a {
        int ˊ;
        int ˋ;
        int ˎ = 0;
        int ˏ;
        int ॱ;

        a() {
        }

        void ˏ(int i, int i2, int i3, int i4) {
            this.ॱ = i;
            this.ˏ = i2;
            this.ˋ = i3;
            this.ˊ = i4;
        }

        void ˎ(int i) {
            this.ˎ |= i;
        }

        void ˏ() {
            this.ˎ = 0;
        }

        int ˊ(int i, int i2) {
            if (i > i2) {
                return 1;
            }
            if (i == i2) {
                return 2;
            }
            return 4;
        }

        boolean ˋ() {
            if ((this.ˎ & 7) != 0 && (this.ˎ & (ˊ(this.ˋ, this.ॱ) << 0)) == 0) {
                return false;
            }
            if ((this.ˎ & 112) != 0 && (this.ˎ & (ˊ(this.ˋ, this.ˏ) << 4)) == 0) {
                return false;
            }
            if ((this.ˎ & 1792) != 0 && (this.ˎ & (ˊ(this.ˊ, this.ॱ) << 8)) == 0) {
                return false;
            }
            if ((this.ˎ & 28672) == 0 || (this.ˎ & (ˊ(this.ˊ, this.ˏ) << 12)) != 0) {
                return true;
            }
            return false;
        }
    }

    ViewBoundsCheck(e eVar) {
        this.ˋ = eVar;
    }

    View ॱ(int i, int i2, int i3, int i4) {
        int ˊ = this.ˋ.ˊ();
        int ˏ = this.ˋ.ˏ();
        int i5 = i2 > i ? 1 : -1;
        View view = null;
        while (i != i2) {
            View ˎ = this.ˋ.ˎ(i);
            this.ˎ.ˏ(ˊ, ˏ, this.ˋ.ॱ(ˎ), this.ˋ.ˊ(ˎ));
            if (i3 != 0) {
                this.ˎ.ˏ();
                this.ˎ.ˎ(i3);
                if (this.ˎ.ˋ()) {
                    return ˎ;
                }
            }
            if (i4 != 0) {
                this.ˎ.ˏ();
                this.ˎ.ˎ(i4);
                if (this.ˎ.ˋ()) {
                    i += i5;
                    view = ˎ;
                }
            }
            ˎ = view;
            i += i5;
            view = ˎ;
        }
        return view;
    }

    boolean ˎ(View view, int i) {
        this.ˎ.ˏ(this.ˋ.ˊ(), this.ˋ.ˏ(), this.ˋ.ॱ(view), this.ˋ.ˊ(view));
        if (i == 0) {
            return false;
        }
        this.ˎ.ˏ();
        this.ˎ.ˎ(i);
        return this.ˎ.ˋ();
    }
}
